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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
a = C("a")
c = D("c")
j = E("j")
k = F("k")
f = F("f")

g.q = j
l.o = g
l.u = j
a.r = c
a.y = l
a.p = l
c.u = a
j.z = a
k.o = g
k.u = j
k.y = j
k.w = l
k.x = l
k.p = f
f.o = g
f.u = j
f.y = j
f.w = l
f.x = l
f.p = k
assert g.q.z.r.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
a = C("a")
c = D("c")
j = E("j")
k = F("k")
f = F("f")

g.q = j
l.o = g
l.u = j
a.r = c
a.y = l
a.p = l
c.u = a
j.z = a
k.o = g
k.u = j
k.y = j
k.w = l
k.x = l
k.p = f
f.o = g
f.u = j
f.y = j
f.w = l
f.x = l
f.p = k
assert g.q.z.r.u.y.txt == "l"