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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: A = None
        self.q: D = 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.z: D = None
        self.txt = txt

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

b.y = j
b.t = m
b.v = m
n.r = c
n.w = c
n.v = m
n.o = m
l.t = j
l.p = i
l.q = k
j.s = l
c.z = k
h.r = f
h.w = f
h.v = l
h.o = l
f.z = j
i.y = j
i.t = m
i.v = l
k.s = m
m.t = k
m.q = k
m.p = b
assert k.s.q.s.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: C = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: A = None
        self.q: D = 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.z: D = None
        self.txt = txt

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

b.y = j
b.t = m
b.v = m
n.r = c
n.w = c
n.v = m
n.o = m
l.t = j
l.p = i
l.q = k
j.s = l
c.z = k
h.r = f
h.w = f
h.v = l
h.o = l
f.z = j
i.y = j
i.t = m
i.v = l
k.s = m
m.t = k
m.q = k
m.p = b
assert k.s.q.s.p.t.p.txt == "b"