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

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

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

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

c = A("c")
g = B("g")
b = C("b")
l = D("l")
j = B("j")
f = D("f")
d = A("d")
h = B("h")

c.z = f
c.p = g
c.t = d
c.o = b
g.w = c
g.t = l
b.p = d
b.z = l
l.t = d
l.x = c
l.s = c
j.w = c
j.t = f
f.t = d
f.x = c
f.s = c
d.z = f
d.p = j
d.t = c
d.o = b
h.w = c
h.t = l
assert l.s.t.t.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: B = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
b = C("b")
l = D("l")
j = B("j")
f = D("f")
d = A("d")
h = B("h")

c.z = f
c.p = g
c.t = d
c.o = b
g.w = c
g.t = l
b.p = d
b.z = l
l.t = d
l.x = c
l.s = c
j.w = c
j.t = f
f.t = d
f.x = c
f.s = c
d.z = f
d.p = j
d.t = c
d.o = b
h.w = c
h.t = l
assert l.s.t.t.o.z.txt == "l"