class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: E = None
        self.z: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

l = A("l")
d = B("d")
g = C("g")
c = D("c")
b = E("b")
e = F("e")
m = C("m")

l.x = e
l.t = b
l.z = d
l.y = d
d.p = e
d.t = g
d.w = l
g.v = c
c.u = b
c.o = e
b.y = g
b.p = e
e.u = m
e.q = b
e.t = b
m.v = c
assert g.v.o.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: E = None
        self.z: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

l = A("l")
d = B("d")
g = C("g")
c = D("c")
b = E("b")
e = F("e")
m = C("m")

l.x = e
l.t = b
l.z = d
l.y = d
d.p = e
d.t = g
d.w = l
g.v = c
c.u = b
c.o = e
b.y = g
b.p = e
e.u = m
e.q = b
e.t = b
m.v = c
assert g.v.o.u.v.txt == "c"