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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: A = None
        self.s: D = None
        self.r: C = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
b = C("b")
m = D("m")
a = D("a")
j = B("j")

c.x = b
c.z = b
c.y = b
c.v = j
i.t = c
i.q = c
i.s = a
i.r = b
b.w = i
m.u = b
a.u = b
j.t = c
j.q = c
j.s = a
j.r = b
assert c.y.w.q.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: A = None
        self.s: D = None
        self.r: C = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
b = C("b")
m = D("m")
a = D("a")
j = B("j")

c.x = b
c.z = b
c.y = b
c.v = j
i.t = c
i.q = c
i.s = a
i.r = b
b.w = i
m.u = b
a.u = b
j.t = c
j.q = c
j.s = a
j.r = b
assert c.y.w.q.v.t.txt == "c"