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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: A = None
        self.y: D = None
        self.o: E = None
        self.z: A = None
        self.txt = txt

f = A("f")
d = B("d")
g = C("g")
a = D("a")
c = E("c")
j = E("j")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: A = None
        self.y: D = None
        self.o: E = None
        self.z: A = None
        self.txt = txt

f = A("f")
d = B("d")
g = C("g")
a = D("a")
c = E("c")
j = E("j")

f.p = a
f.x = g
f.y = g
f.q = j
f.z = c
d.t = g
d.r = c
g.w = d
g.o = d
g.v = a
a.v = f
a.p = f
a.y = g
a.s = g
c.w = f
c.u = f
c.z = f
c.y = a
c.o = j
j.w = f
j.u = f
j.z = f
j.y = a
j.o = c
assert a.p.q.o.w.x.txt == "g"