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

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

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

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

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

n = A("n")
f = B("f")
h = C("h")
a = D("a")
k = E("k")
e = C("e")

n.r = a
f.z = a
h.u = k
h.r = k
a.p = h
a.x = k
a.t = f
a.r = f
k.r = n
k.v = h
k.x = a
e.u = k
e.r = k
assert e.r.r.r.x.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

n = A("n")
f = B("f")
h = C("h")
a = D("a")
k = E("k")
e = C("e")

n.r = a
f.z = a
h.u = k
h.r = k
a.p = h
a.x = k
a.t = f
a.r = f
k.r = n
k.v = h
k.x = a
e.u = k
e.r = k
assert e.r.r.r.x.v.u.txt == "k"