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

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

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

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

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

b.q = h
b.t = i
b.u = i
j.r = k
j.y = n
m.x = j
a.x = n
d.x = h
i.q = h
i.t = b
i.u = b
h.r = k
h.y = a
n.x = a
k.r = j
k.y = a
assert h.y.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

b.q = h
b.t = i
b.u = i
j.r = k
j.y = n
m.x = j
a.x = n
d.x = h
i.q = h
i.t = b
i.u = b
h.r = k
h.y = a
n.x = a
k.r = j
k.y = a
assert h.y.x.x.x.x.x.x.x.txt == "n"