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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.q: B = None
        self.t: D = None
        self.v: E = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
l = C("l")
d = D("d")
g = E("g")
b = D("b")

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.q: B = None
        self.t: D = None
        self.v: E = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
l = C("l")
d = D("d")
g = E("g")
b = D("b")

f.o = e
e.x = d
e.r = g
l.p = g
l.v = g
l.z = d
l.q = e
l.t = b
d.u = f
d.p = l
d.y = b
g.v = l
b.u = f
b.p = l
b.y = d
assert d.u.o.x.txt == "d"