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

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

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

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

j = A("j")
a = B("a")
d = C("d")
g = D("g")
e = C("e")
k = B("k")
b = A("b")

j.q = e
j.p = b
j.s = g
j.o = g
a.z = d
a.o = e
a.x = g
d.t = e
g.x = b
g.s = j
e.t = d
k.z = d
k.o = d
k.x = g
b.q = e
b.p = j
b.s = g
b.o = g
assert g.x.p.s.s.q.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

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

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

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

j = A("j")
a = B("a")
d = C("d")
g = D("g")
e = C("e")
k = B("k")
b = A("b")

j.q = e
j.p = b
j.s = g
j.o = g
a.z = d
a.o = e
a.x = g
d.t = e
g.x = b
g.s = j
e.t = d
k.z = d
k.o = d
k.x = g
b.q = e
b.p = j
b.s = g
b.o = g
assert g.x.p.s.s.q.t.t.txt == "e"