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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

e.t = c
e.r = c
e.p = g
c.u = f
g.x = c
g.r = c
g.u = a
g.y = a
g.w = f
a.r = g
f.p = g
f.r = g
f.s = g
f.t = a
f.u = c
assert e.p.u.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: C = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

e.t = c
e.r = c
e.p = g
c.u = f
g.x = c
g.r = c
g.u = a
g.y = a
g.w = f
a.r = g
f.p = g
f.r = g
f.s = g
f.t = a
f.u = c
assert e.p.u.r.u.r.txt == "g"