class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: E = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

b.r = h
b.u = j
b.p = c
c.t = g
c.z = b
c.x = b
h.o = b
h.s = g
l.o = g
l.z = h
j.q = b
g.o = l
g.z = h
assert b.p.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: E = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

b.r = h
b.u = j
b.p = c
c.t = g
c.z = b
c.x = b
h.o = b
h.s = g
l.o = g
l.z = h
j.q = b
g.o = l
g.z = h
assert b.p.t.o.txt == "l"