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

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

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

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

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

i = A("i")
e = B("e")
l = C("l")
b = D("b")
h = E("h")
k = A("k")
g = C("g")

i.x = e
e.u = g
e.x = b
e.t = i
l.x = h
b.s = g
h.o = b
h.s = b
h.r = b
h.p = e
k.x = e
g.x = h
assert h.r.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

i = A("i")
e = B("e")
l = C("l")
b = D("b")
h = E("h")
k = A("k")
g = C("g")

i.x = e
e.u = g
e.x = b
e.t = i
l.x = h
b.s = g
h.o = b
h.s = b
h.r = b
h.p = e
k.x = e
g.x = h
assert h.r.s.x.txt == "h"