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

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

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

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

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

h = A("h")
n = B("n")
b = C("b")
k = D("k")
l = E("l")

h.s = b
h.r = b
h.u = b
n.u = k
b.x = h
b.t = k
k.r = l
k.p = l
k.z = n
k.y = n
l.t = b
l.u = k
assert h.r.t.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

h = A("h")
n = B("n")
b = C("b")
k = D("k")
l = E("l")

h.s = b
h.r = b
h.u = b
n.u = k
b.x = h
b.t = k
k.r = l
k.p = l
k.z = n
k.y = n
l.t = b
l.u = k
assert h.r.t.r.u.txt == "k"