class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

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

g.x = d
a.t = g
d.v = g
e.p = c
e.s = b
e.v = g
j.v = c
j.u = d
j.r = e
j.x = e
c.v = j
c.u = d
c.r = e
c.x = e
b.x = d
assert c.u.v.x.v.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

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

g.x = d
a.t = g
d.v = g
e.p = c
e.s = b
e.v = g
j.v = c
j.u = d
j.r = e
j.x = e
c.v = j
c.u = d
c.r = e
c.x = e
b.x = d
assert c.u.v.x.v.x.v.x.txt == "d"