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

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

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

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

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

c.q = n
c.s = n
c.z = h
c.u = e
g.u = b
n.x = e
n.s = e
n.o = g
n.q = g
e.q = c
e.y = c
k.x = e
k.s = e
k.o = b
k.q = g
b.u = g
h.q = k
h.s = k
h.z = c
h.u = e
assert n.q.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.z: A = None
        self.u: D = None
        self.txt = txt

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

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

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

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

c.q = n
c.s = n
c.z = h
c.u = e
g.u = b
n.x = e
n.s = e
n.o = g
n.q = g
e.q = c
e.y = c
k.x = e
k.s = e
k.o = b
k.q = g
b.u = g
h.q = k
h.s = k
h.z = c
h.u = e
assert n.q.u.u.u.txt == "b"