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

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

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

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

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

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

h.x = g
h.v = c
j.o = d
l.q = c
b.x = c
b.z = k
e.x = k
e.s = k
e.r = b
e.w = g
e.v = h
d.x = j
d.z = k
k.x = e
k.s = e
k.r = d
k.w = g
k.v = h
c.o = b
g.q = c
assert k.v.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

h.x = g
h.v = c
j.o = d
l.q = c
b.x = c
b.z = k
e.x = k
e.s = k
e.r = b
e.w = g
e.v = h
d.x = j
d.z = k
k.x = e
k.s = e
k.r = d
k.w = g
k.v = h
c.o = b
g.q = c
assert k.v.x.q.txt == "c"