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

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

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

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

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

f.p = g
c.p = n
c.o = e
c.u = f
b.x = n
b.q = a
b.u = i
a.u = b
a.s = f
a.x = n
g.p = e
g.o = a
g.u = f
j.x = n
j.q = e
j.u = i
l.p = a
l.o = e
l.u = f
i.x = a
i.q = n
i.u = b
e.u = j
e.s = f
e.x = a
n.u = b
n.s = f
n.x = a
assert i.x.x.u.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

f.p = g
c.p = n
c.o = e
c.u = f
b.x = n
b.q = a
b.u = i
a.u = b
a.s = f
a.x = n
g.p = e
g.o = a
g.u = f
j.x = n
j.q = e
j.u = i
l.p = a
l.o = e
l.u = f
i.x = a
i.q = n
i.u = b
e.u = j
e.s = f
e.x = a
n.u = b
n.s = f
n.x = a
assert i.x.x.u.u.q.u.txt == "b"