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

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

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

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

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

b.u = f
b.z = f
b.x = c
k.y = l
k.s = d
k.p = b
k.v = f
f.p = b
f.s = l
l.r = f
a.u = f
a.z = f
a.x = l
e.u = f
e.z = f
e.x = l
j.u = f
j.z = f
j.x = l
c.r = f
i.u = f
i.z = f
i.x = c
d.r = f
assert f.s.r.p.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.x: D = None
        self.txt = txt

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

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

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

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

b.u = f
b.z = f
b.x = c
k.y = l
k.s = d
k.p = b
k.v = f
f.p = b
f.s = l
l.r = f
a.u = f
a.z = f
a.x = l
e.u = f
e.z = f
e.x = l
j.u = f
j.z = f
j.x = l
c.r = f
i.u = f
i.z = f
i.x = c
d.r = f
assert f.s.r.p.x.r.txt == "f"