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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: D = None
        self.o: D = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

f.q = h
m.v = h
m.p = j
m.o = j
m.w = j
m.z = j
i.w = j
i.r = f
h.q = f
h.v = l
h.o = j
e.r = m
e.p = l
e.x = h
l.r = m
l.p = e
l.x = h
k.q = j
j.q = f
j.v = l
j.o = h
assert e.p.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: D = None
        self.o: D = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

f.q = h
m.v = h
m.p = j
m.o = j
m.w = j
m.z = j
i.w = j
i.r = f
h.q = f
h.v = l
h.o = j
e.r = m
e.p = l
e.x = h
l.r = m
l.p = e
l.x = h
k.q = j
j.q = f
j.v = l
j.o = h
assert e.p.p.x.txt == "h"