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

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

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

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

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

c = A("c")
f = B("f")
j = C("j")
k = D("k")
d = E("d")
h = B("h")
n = B("n")

c.p = n
c.v = d
c.r = h
f.t = k
j.t = k
k.u = d
d.t = k
d.r = k
h.t = k
n.t = k
assert h.t.u.r.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
j = C("j")
k = D("k")
d = E("d")
h = B("h")
n = B("n")

c.p = n
c.v = d
c.r = h
f.t = k
j.t = k
k.u = d
d.t = k
d.r = k
h.t = k
n.t = k
assert h.t.u.r.u.t.u.t.txt == "k"