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

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

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

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

e = A("e")
j = B("j")
f = C("f")
i = D("i")
n = B("n")
h = D("h")
g = B("g")
l = A("l")
a = A("a")

e.o = j
j.p = g
j.x = f
j.y = f
f.z = j
f.v = i
i.q = n
i.r = l
n.p = j
n.x = f
n.y = f
h.q = g
h.r = e
g.p = j
g.x = f
g.y = f
l.o = g
a.o = g
assert e.o.p.p.y.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
f = C("f")
i = D("i")
n = B("n")
h = D("h")
g = B("g")
l = A("l")
a = A("a")

e.o = j
j.p = g
j.x = f
j.y = f
f.z = j
f.v = i
i.q = n
i.r = l
n.p = j
n.x = f
n.y = f
h.q = g
h.r = e
g.p = j
g.x = f
g.y = f
l.o = g
a.o = g
assert e.o.p.p.y.v.r.txt == "l"