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

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

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

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

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

b = A("b")
m = B("m")
l = C("l")
g = D("g")
k = E("k")
n = A("n")
h = B("h")

b.t = n
m.y = h
m.u = h
m.q = b
l.p = n
l.t = g
l.y = b
g.r = b
g.o = k
k.q = l
n.t = b
h.y = m
h.u = m
h.q = b
assert k.q.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
l = C("l")
g = D("g")
k = E("k")
n = A("n")
h = B("h")

b.t = n
m.y = h
m.u = h
m.q = b
l.p = n
l.t = g
l.y = b
g.r = b
g.o = k
k.q = l
n.t = b
h.y = m
h.u = m
h.q = b
assert k.q.y.t.txt == "n"