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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: D = None
        self.v: B = None
        self.txt = txt

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

m.s = j
m.x = l
m.o = l
m.q = e
c.t = n
e.x = m
e.q = g
n.p = c
n.v = c
n.z = b
j.t = n
k.t = b
l.t = b
b.p = c
b.z = n
b.v = k
h.t = n
g.s = j
g.x = c
g.q = e
g.o = l
assert j.t.z.v.t.z.p.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.q: C = None
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: D = None
        self.v: B = None
        self.txt = txt

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

m.s = j
m.x = l
m.o = l
m.q = e
c.t = n
e.x = m
e.q = g
n.p = c
n.v = c
n.z = b
j.t = n
k.t = b
l.t = b
b.p = c
b.z = n
b.v = k
h.t = n
g.s = j
g.x = c
g.q = e
g.o = l
assert j.t.z.v.t.z.p.t.z.txt == "b"