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

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

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

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

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

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

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

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

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

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

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

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

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

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

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