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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
i = C("i")
e = D("e")
k = A("k")
f = B("f")
j = A("j")
b = A("b")

c.p = k
c.u = e
c.r = i
l.p = b
i.y = c
e.t = k
e.w = c
k.p = c
k.u = e
k.r = i
f.p = c
j.p = k
j.u = e
j.r = i
b.p = k
b.u = e
b.r = i
assert j.r.y.p.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
i = C("i")
e = D("e")
k = A("k")
f = B("f")
j = A("j")
b = A("b")

c.p = k
c.u = e
c.r = i
l.p = b
i.y = c
e.t = k
e.w = c
k.p = c
k.u = e
k.r = i
f.p = c
j.p = k
j.u = e
j.r = i
b.p = k
b.u = e
b.r = i
assert j.r.y.p.r.y.txt == "c"