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

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

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

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

e = A("e")
n = B("n")
i = C("i")
m = D("m")
h = D("h")
b = A("b")
a = C("a")
c = A("c")
d = A("d")

e.q = n
e.t = h
n.y = m
i.r = e
i.x = a
m.u = i
m.x = h
m.y = h
m.v = n
h.u = i
h.x = m
h.y = m
h.v = n
b.q = n
b.t = h
a.r = c
a.x = i
c.q = n
c.t = m
d.q = n
d.t = m
assert i.r.t.v.y.x.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
i = C("i")
m = D("m")
h = D("h")
b = A("b")
a = C("a")
c = A("c")
d = A("d")

e.q = n
e.t = h
n.y = m
i.r = e
i.x = a
m.u = i
m.x = h
m.y = h
m.v = n
h.u = i
h.x = m
h.y = m
h.v = n
b.q = n
b.t = h
a.r = c
a.x = i
c.q = n
c.t = m
d.q = n
d.t = m
assert i.r.t.v.y.x.v.y.y.txt == "h"