class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: B = None
        self.s: G = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

b = A("b")
l = B("l")
k = C("k")
c = D("c")
j = E("j")
d = F("d")
a = G("a")
h = D("h")
e = E("e")

b.u = l
b.q = h
b.z = c
l.w = j
l.z = k
k.v = j
k.t = b
c.o = d
c.u = l
c.q = l
c.s = a
c.y = k
j.q = d
d.p = l
d.y = l
a.u = b
h.o = d
h.u = l
h.q = l
h.s = a
h.y = k
e.q = d
assert c.o.p.z.t.u.z.t.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: B = None
        self.s: G = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

b = A("b")
l = B("l")
k = C("k")
c = D("c")
j = E("j")
d = F("d")
a = G("a")
h = D("h")
e = E("e")

b.u = l
b.q = h
b.z = c
l.w = j
l.z = k
k.v = j
k.t = b
c.o = d
c.u = l
c.q = l
c.s = a
c.y = k
j.q = d
d.p = l
d.y = l
a.u = b
h.o = d
h.u = l
h.q = l
h.s = a
h.y = k
e.q = d
assert c.o.p.z.t.u.z.t.u.z.txt == "k"