class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: B = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
b = C("b")
j = D("j")
i = D("i")
g = A("g")
n = D("n")
d = C("d")
f = D("f")

k.t = j
k.p = j
k.u = l
k.w = b
l.x = b
l.v = k
l.r = j
l.w = n
b.q = l
b.s = l
b.p = i
j.r = i
i.r = f
g.t = j
g.p = j
g.u = l
g.w = b
n.r = j
d.q = l
d.s = l
d.p = f
f.r = n
assert j.r.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: B = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
b = C("b")
j = D("j")
i = D("i")
g = A("g")
n = D("n")
d = C("d")
f = D("f")

k.t = j
k.p = j
k.u = l
k.w = b
l.x = b
l.v = k
l.r = j
l.w = n
b.q = l
b.s = l
b.p = i
j.r = i
i.r = f
g.t = j
g.p = j
g.u = l
g.w = b
n.r = j
d.q = l
d.s = l
d.p = f
f.r = n
assert j.r.r.r.r.r.r.r.r.r.txt == "i"