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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: D = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

k = A("k")
f = B("f")
m = C("m")
h = D("h")

k.s = h
k.o = m
k.r = m
k.t = m
f.r = m
f.u = m
f.v = m
f.p = m
m.x = k
m.p = h
m.v = h
m.u = f
h.r = m
assert f.r.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: C = None
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: D = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

k = A("k")
f = B("f")
m = C("m")
h = D("h")

k.s = h
k.o = m
k.r = m
k.t = m
f.r = m
f.u = m
f.v = m
f.p = m
m.x = k
m.p = h
m.v = h
m.u = f
h.r = m
assert f.r.u.r.u.txt == "f"