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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: C = None
        self.u: A = None
        self.p: A = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
k = C("k")
e = D("e")
c = A("c")
a = A("a")
h = D("h")
f = A("f")
l = B("l")

j.u = n
j.q = n
j.y = a
n.s = c
n.p = c
n.y = k
n.u = j
k.x = j
e.r = k
c.u = n
c.q = n
c.y = a
a.u = n
a.q = l
a.y = c
h.r = k
f.u = l
f.q = l
f.y = c
l.s = f
l.y = k
l.u = j
l.p = c
assert c.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: C = None
        self.u: A = None
        self.p: A = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
k = C("k")
e = D("e")
c = A("c")
a = A("a")
h = D("h")
f = A("f")
l = B("l")

j.u = n
j.q = n
j.y = a
n.s = c
n.p = c
n.y = k
n.u = j
k.x = j
e.r = k
c.u = n
c.q = n
c.y = a
a.u = n
a.q = l
a.y = c
h.r = k
f.u = l
f.q = l
f.y = c
l.s = f
l.y = k
l.u = j
l.p = c
assert c.y.u.y.txt == "k"