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

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

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

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

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

m.u = j
m.r = j
m.y = n
n.p = k
n.x = j
n.q = j
n.u = j
j.y = n
j.u = n
j.v = e
e.x = b
e.u = b
e.y = b
b.x = e
b.u = e
b.y = e
k.u = j
k.r = j
k.y = n
assert m.y.p.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

m.u = j
m.r = j
m.y = n
n.p = k
n.x = j
n.q = j
n.u = j
j.y = n
j.u = n
j.v = e
e.x = b
e.u = b
e.y = b
b.x = e
b.u = e
b.y = e
k.u = j
k.r = j
k.y = n
assert m.y.p.r.y.txt == "n"