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

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

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

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

l = A("l")
b = B("b")
i = C("i")
g = D("g")
n = D("n")
j = A("j")
m = C("m")
c = B("c")

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

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

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

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

l = A("l")
b = B("b")
i = C("i")
g = D("g")
n = D("n")
j = A("j")
m = C("m")
c = B("c")

l.t = c
l.w = i
b.s = m
b.x = n
b.w = g
b.o = i
i.p = c
i.o = c
i.q = g
i.z = g
g.t = l
g.z = n
g.p = j
n.t = j
n.p = j
n.z = g
j.t = b
j.w = m
m.p = c
m.q = n
m.z = g
m.o = b
c.s = m
c.o = m
c.x = n
c.w = n
assert j.t.w.z.z.z.t.w.z.txt == "g"