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

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

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

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

i = A("i")
h = B("h")
j = C("j")
n = D("n")
m = D("m")
b = A("b")

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

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

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

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

i = A("i")
h = B("h")
j = C("j")
n = D("n")
m = D("m")
b = A("b")

i.r = j
i.y = j
i.z = h
h.t = j
h.q = m
h.s = b
j.q = n
j.w = b
n.u = j
m.u = j
b.r = j
b.y = j
b.z = h
assert b.y.w.y.w.y.w.txt == "b"