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

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

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

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

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

f.t = n
f.p = a
f.u = d
i.s = m
i.y = b
i.o = k
d.r = a
c.u = n
c.p = b
c.r = b
b.u = n
b.p = c
b.r = c
k.s = m
k.y = c
k.o = i
m.s = k
m.y = b
m.o = i
a.r = d
n.t = f
n.p = d
n.u = a
assert k.o.s.o.o.y.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

f.t = n
f.p = a
f.u = d
i.s = m
i.y = b
i.o = k
d.r = a
c.u = n
c.p = b
c.r = b
b.u = n
b.p = c
b.r = c
k.s = m
k.y = c
k.o = i
m.s = k
m.y = b
m.o = i
a.r = d
n.t = f
n.p = d
n.u = a
assert k.o.s.o.o.y.u.u.r.txt == "d"