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

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

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

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

i = A("i")
j = B("j")
n = C("n")
c = D("c")
h = B("h")
e = B("e")
b = C("b")
f = C("f")
g = A("g")
k = D("k")

i.x = n
j.u = f
j.q = h
n.y = k
c.q = i
c.x = h
c.t = b
h.u = b
h.q = e
e.u = b
e.q = h
b.y = k
f.y = c
g.x = b
k.q = g
k.x = j
k.t = n
assert k.q.x.y.t.y.t.y.x.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
n = C("n")
c = D("c")
h = B("h")
e = B("e")
b = C("b")
f = C("f")
g = A("g")
k = D("k")

i.x = n
j.u = f
j.q = h
n.y = k
c.q = i
c.x = h
c.t = b
h.u = b
h.q = e
e.u = b
e.q = h
b.y = k
f.y = c
g.x = b
k.q = g
k.x = j
k.t = n
assert k.q.x.y.t.y.t.y.x.u.y.txt == "c"