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

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

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

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

c = A("c")
j = B("j")
f = C("f")
d = D("d")
n = D("n")
k = A("k")
a = B("a")
i = C("i")
g = D("g")

c.x = a
c.s = k
j.q = a
j.y = a
f.t = g
f.u = i
d.y = i
d.u = i
n.y = f
n.u = i
k.x = a
k.s = c
a.q = j
a.y = j
i.t = g
i.u = f
g.y = i
g.u = i
assert n.y.t.u.t.u.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
f = C("f")
d = D("d")
n = D("n")
k = A("k")
a = B("a")
i = C("i")
g = D("g")

c.x = a
c.s = k
j.q = a
j.y = a
f.t = g
f.u = i
d.y = i
d.u = i
n.y = f
n.u = i
k.x = a
k.s = c
a.q = j
a.y = j
i.t = g
i.u = f
g.y = i
g.u = i
assert n.y.t.u.t.u.u.t.u.txt == "i"