class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: B = None
        self.p: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: F = None
        self.r: B = None
        self.q: C = None
        self.o: D = None
        self.w: C = None
        self.txt = txt

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

g = A("g")
e = B("e")
j = C("j")
k = D("k")
n = E("n")
a = F("a")
b = F("b")

g.t = j
g.p = j
g.r = j
g.u = e
e.y = j
e.o = j
j.w = g
j.v = n
k.p = g
k.o = g
n.v = e
n.r = e
n.p = a
n.q = j
n.w = j
n.o = k
a.w = e
b.w = e
assert a.w.y.w.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: B = None
        self.p: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: F = None
        self.r: B = None
        self.q: C = None
        self.o: D = None
        self.w: C = None
        self.txt = txt

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

g = A("g")
e = B("e")
j = C("j")
k = D("k")
n = E("n")
a = F("a")
b = F("b")

g.t = j
g.p = j
g.r = j
g.u = e
e.y = j
e.o = j
j.w = g
j.v = n
k.p = g
k.o = g
n.v = e
n.r = e
n.p = a
n.q = j
n.w = j
n.o = k
a.w = e
b.w = e
assert a.w.y.w.u.o.txt == "j"