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

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

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

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

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

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

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

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

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

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

m.t = g
m.y = g
m.o = c
c.y = i
c.p = j
j.y = m
j.p = m
j.x = i
i.q = l
i.p = g
i.s = c
i.z = j
g.t = m
g.y = m
g.o = c
a.y = g
a.p = m
a.x = l
l.q = i
l.p = m
l.s = c
l.z = j
assert c.y.s.y.txt == "i"