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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: C = None
        self.v: B = None
        self.txt = txt

j = A("j")
h = B("h")
c = C("c")
f = D("f")
k = E("k")
n = A("n")
g = E("g")
l = C("l")
b = D("b")

j.o = l
h.x = b
c.p = l
c.y = l
c.o = l
c.x = j
f.q = g
k.q = g
k.w = c
k.v = h
n.o = c
g.q = k
g.w = c
g.v = h
l.p = c
l.y = c
l.o = c
l.x = j
b.q = g
assert g.q.w.y.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: C = None
        self.v: B = None
        self.txt = txt

j = A("j")
h = B("h")
c = C("c")
f = D("f")
k = E("k")
n = A("n")
g = E("g")
l = C("l")
b = D("b")

j.o = l
h.x = b
c.p = l
c.y = l
c.o = l
c.x = j
f.q = g
k.q = g
k.w = c
k.v = h
n.o = c
g.q = k
g.w = c
g.v = h
l.p = c
l.y = c
l.o = c
l.x = j
b.q = g
assert g.q.w.y.x.o.x.txt == "j"