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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: A = None
        self.v: B = None
        self.w: D = None
        self.txt = txt

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

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

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

l = A("l")
a = B("a")
b = C("b")
d = D("d")
g = E("g")
i = F("i")

l.y = g
l.p = b
a.t = i
a.w = i
a.z = i
a.u = d
b.u = a
b.v = a
b.s = l
b.w = d
d.w = g
d.q = g
d.z = b
g.o = i
g.p = l
i.x = g
assert b.w.q.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: A = None
        self.v: B = None
        self.w: D = None
        self.txt = txt

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

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

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

l = A("l")
a = B("a")
b = C("b")
d = D("d")
g = E("g")
i = F("i")

l.y = g
l.p = b
a.t = i
a.w = i
a.z = i
a.u = d
b.u = a
b.v = a
b.s = l
b.w = d
d.w = g
d.q = g
d.z = b
g.o = i
g.p = l
i.x = g
assert b.w.q.o.x.o.txt == "i"