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

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

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

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

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

c.x = j
c.o = j
c.t = m
c.p = b
g.z = b
g.q = b
m.u = j
m.r = c
b.w = c
b.o = c
b.y = h
a.w = c
a.o = c
a.y = g
d.u = j
d.r = j
j.x = c
j.o = c
j.t = m
j.p = a
h.z = b
h.q = b
n.z = b
n.q = a
k.z = a
k.q = b
assert b.w.t.u.t.r.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: C = None
        self.p: D = None
        self.o: A = None
        self.txt = txt

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

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

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

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

c.x = j
c.o = j
c.t = m
c.p = b
g.z = b
g.q = b
m.u = j
m.r = c
b.w = c
b.o = c
b.y = h
a.w = c
a.o = c
a.y = g
d.u = j
d.r = j
j.x = c
j.o = c
j.t = m
j.p = a
h.z = b
h.q = b
n.z = b
n.q = a
k.z = a
k.q = b
assert b.w.t.u.t.r.t.r.t.txt == "m"