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

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

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

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

c = A("c")
e = B("e")
i = C("i")
k = D("k")
g = C("g")
b = B("b")
j = D("j")
a = B("a")
l = D("l")

c.y = a
c.t = a
c.o = a
c.w = g
e.x = b
e.t = g
i.p = g
i.z = g
i.x = c
i.t = k
k.t = i
k.p = l
g.p = i
g.z = i
g.x = c
g.t = j
b.x = e
b.t = i
j.t = i
j.p = k
a.x = b
a.t = g
l.t = g
l.p = k
assert k.t.z.x.t.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: C = None
        self.t: B = None
        self.o: B = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
i = C("i")
k = D("k")
g = C("g")
b = B("b")
j = D("j")
a = B("a")
l = D("l")

c.y = a
c.t = a
c.o = a
c.w = g
e.x = b
e.t = g
i.p = g
i.z = g
i.x = c
i.t = k
k.t = i
k.p = l
g.p = i
g.z = i
g.x = c
g.t = j
b.x = e
b.t = i
j.t = i
j.p = k
a.x = b
a.t = g
l.t = g
l.p = k
assert k.t.z.x.t.t.p.t.txt == "k"