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

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

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

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

i = A("i")
l = B("l")
e = C("e")
h = D("h")
c = D("c")
f = C("f")
j = A("j")

i.p = l
i.q = c
l.z = e
l.r = i
l.t = c
e.o = l
e.w = c
e.t = c
e.p = f
h.p = f
h.x = f
h.z = i
h.t = l
c.p = f
c.x = f
c.z = i
c.t = l
f.o = l
f.w = h
f.t = c
f.p = e
j.p = l
j.q = c
assert l.z.o.t.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: D = None
        self.txt = txt

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

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

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

i = A("i")
l = B("l")
e = C("e")
h = D("h")
c = D("c")
f = C("f")
j = A("j")

i.p = l
i.q = c
l.z = e
l.r = i
l.t = c
e.o = l
e.w = c
e.t = c
e.p = f
h.p = f
h.x = f
h.z = i
h.t = l
c.p = f
c.x = f
c.z = i
c.t = l
f.o = l
f.w = h
f.t = c
f.p = e
j.p = l
j.q = c
assert l.z.o.t.z.q.txt == "c"