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

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

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

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

m = A("m")
k = B("k")
j = C("j")
h = D("h")
d = D("d")
b = A("b")
l = B("l")

m.r = k
m.q = j
m.p = j
m.x = j
k.v = l
j.r = m
j.o = h
j.y = h
j.u = k
h.y = d
h.w = m
h.q = m
h.z = b
d.y = h
d.w = m
d.q = m
d.z = m
b.r = k
b.q = j
b.p = j
b.x = j
l.v = k
assert j.u.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: C = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

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

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

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

m = A("m")
k = B("k")
j = C("j")
h = D("h")
d = D("d")
b = A("b")
l = B("l")

m.r = k
m.q = j
m.p = j
m.x = j
k.v = l
j.r = m
j.o = h
j.y = h
j.u = k
h.y = d
h.w = m
h.q = m
h.z = b
d.y = h
d.w = m
d.q = m
d.z = m
b.r = k
b.q = j
b.p = j
b.x = j
l.v = k
assert j.u.v.v.v.v.txt == "k"