class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: A = None
        self.u: F = None
        self.v: E = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.u: C = None
        self.s: C = None
        self.w: F = None
        self.txt = txt

k = A("k")
j = B("j")
d = C("d")
f = D("f")
m = E("m")
a = F("a")
i = G("i")

k.v = j
k.p = j
k.u = m
j.o = i
j.p = k
j.x = k
j.u = a
j.v = m
d.s = a
f.p = m
f.s = d
m.y = f
a.o = d
a.z = k
a.q = k
i.p = d
i.u = d
i.s = d
i.v = m
i.w = a
assert f.p.y.s.s.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: A = None
        self.u: F = None
        self.v: E = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.u: C = None
        self.s: C = None
        self.w: F = None
        self.txt = txt

k = A("k")
j = B("j")
d = C("d")
f = D("f")
m = E("m")
a = F("a")
i = G("i")

k.v = j
k.p = j
k.u = m
j.o = i
j.p = k
j.x = k
j.u = a
j.v = m
d.s = a
f.p = m
f.s = d
m.y = f
a.o = d
a.z = k
a.q = k
i.p = d
i.u = d
i.s = d
i.v = m
i.w = a
assert f.p.y.s.s.o.s.o.txt == "d"