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

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

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

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

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

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

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

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

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

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

e.z = b
b.s = m
b.z = j
b.y = j
b.w = c
m.v = e
m.s = c
j.v = e
j.w = e
j.t = e
j.r = c
c.v = e
c.w = e
c.t = e
c.r = j
assert c.r.v.z.txt == "b"