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

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

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

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

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

d.o = g
d.w = g
d.r = b
d.z = j
j.v = b
j.z = d
b.o = n
b.t = g
n.v = j
n.t = a
i.o = n
i.t = d
c.v = b
c.z = g
a.o = n
a.t = g
g.o = d
g.w = d
g.r = b
g.z = c
l.o = n
l.t = d
h.o = n
h.t = d
assert i.t.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.r: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

d.o = g
d.w = g
d.r = b
d.z = j
j.v = b
j.z = d
b.o = n
b.t = g
n.v = j
n.t = a
i.o = n
i.t = d
c.v = b
c.z = g
a.o = n
a.t = g
g.o = d
g.w = d
g.r = b
g.z = c
l.o = n
l.t = d
h.o = n
h.t = d
assert i.t.z.z.o.txt == "g"