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

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

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

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

k = A("k")
n = B("n")
a = C("a")
c = D("c")
f = D("f")
m = A("m")
b = B("b")

k.r = m
k.t = m
n.x = b
n.s = a
n.u = a
n.v = m
a.x = m
a.w = f
a.s = f
a.u = k
c.r = f
c.x = n
c.o = n
c.s = m
f.r = c
f.x = n
f.o = n
f.s = k
m.r = k
m.t = k
b.x = n
b.s = a
b.u = a
b.v = m
assert c.s.r.r.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: A = None
        self.txt = txt

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

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

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

k = A("k")
n = B("n")
a = C("a")
c = D("c")
f = D("f")
m = A("m")
b = B("b")

k.r = m
k.t = m
n.x = b
n.s = a
n.u = a
n.v = m
a.x = m
a.w = f
a.s = f
a.u = k
c.r = f
c.x = n
c.o = n
c.s = m
f.r = c
f.x = n
f.o = n
f.s = k
m.r = k
m.t = k
b.x = n
b.s = a
b.u = a
b.v = m
assert c.s.r.r.r.t.r.txt == "k"