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

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

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

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

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

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

k.y = j
j.p = b
j.t = e
b.v = j
b.r = c
f.s = k
f.t = c
f.r = c
f.x = b
e.y = j
e.u = k
c.s = k
c.t = f
c.r = f
c.x = b
assert e.y.p.v.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

k.y = j
j.p = b
j.t = e
b.v = j
b.r = c
f.s = k
f.t = c
f.r = c
f.x = b
e.y = j
e.u = k
c.s = k
c.t = f
c.r = f
c.x = b
assert e.y.p.v.t.u.txt == "k"