class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = 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: C = None
        self.w: C = None
        self.z: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
h = C("h")
b = D("b")
k = C("k")
g = D("g")
j = C("j")
n = A("n")
m = B("m")

c.y = g
c.x = n
e.y = b
h.r = k
h.w = k
h.z = m
b.p = j
b.x = k
b.q = g
b.u = m
k.r = h
k.w = h
k.z = m
g.p = j
g.x = k
g.q = b
g.u = e
j.r = h
j.w = k
j.z = e
n.y = b
n.x = c
m.y = g
assert e.y.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = 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: C = None
        self.w: C = None
        self.z: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
h = C("h")
b = D("b")
k = C("k")
g = D("g")
j = C("j")
n = A("n")
m = B("m")

c.y = g
c.x = n
e.y = b
h.r = k
h.w = k
h.z = m
b.p = j
b.x = k
b.q = g
b.u = m
k.r = h
k.w = h
k.z = m
g.p = j
g.x = k
g.q = b
g.u = e
j.r = h
j.w = k
j.z = e
n.y = b
n.x = c
m.y = g
assert e.y.u.y.u.txt == "e"