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

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

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

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

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

l.z = b
l.r = c
g.o = h
g.s = c
n.o = b
n.t = l
c.q = b
c.z = l
c.u = i
b.z = l
b.r = c
h.o = g
h.s = c
i.o = b
i.t = l
assert g.o.s.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: D = None
        self.txt = txt

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

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

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

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

l.z = b
l.r = c
g.o = h
g.s = c
n.o = b
n.t = l
c.q = b
c.z = l
c.u = i
b.z = l
b.r = c
h.o = g
h.s = c
i.o = b
i.t = l
assert g.o.s.z.z.txt == "b"