class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.x: E = None
        self.p: D = None
        self.o: E = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
j = C("j")
g = D("g")
b = E("b")
f = B("f")

c.w = j
c.z = e
c.x = b
c.o = b
c.p = g
e.o = b
e.y = j
j.p = g
j.u = g
g.y = b
g.q = b
g.z = b
b.q = j
b.o = e
b.z = f
f.o = b
f.y = j
assert f.y.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.x: E = None
        self.p: D = None
        self.o: E = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
j = C("j")
g = D("g")
b = E("b")
f = B("f")

c.w = j
c.z = e
c.x = b
c.o = b
c.p = g
e.o = b
e.y = j
j.p = g
j.u = g
g.y = b
g.q = b
g.z = b
b.q = j
b.o = e
b.z = f
f.o = b
f.y = j
assert f.y.p.q.txt == "b"