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

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

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

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

c = A("c")
k = B("k")
l = C("l")
j = D("j")
i = B("i")
a = D("a")

c.y = a
c.r = l
c.v = i
k.p = l
k.t = c
k.z = c
k.v = a
l.p = c
l.w = a
l.v = k
j.u = c
j.x = c
i.p = l
i.t = c
i.z = c
i.v = a
a.u = c
a.x = c
assert l.p.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: C = None
        self.v: B = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
l = C("l")
j = D("j")
i = B("i")
a = D("a")

c.y = a
c.r = l
c.v = i
k.p = l
k.t = c
k.z = c
k.v = a
l.p = c
l.w = a
l.v = k
j.u = c
j.x = c
i.p = l
i.t = c
i.z = c
i.v = a
a.u = c
a.x = c
assert l.p.y.u.txt == "c"