class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.o: B = None
        self.txt = txt

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

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

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

b = A("b")
a = B("a")
c = C("c")
e = D("e")
m = C("m")
i = B("i")
n = B("n")
j = D("j")
g = A("g")

b.p = g
b.w = g
b.o = a
a.u = i
c.w = b
e.x = g
e.s = g
e.u = g
e.y = a
m.w = b
i.u = n
n.u = a
j.x = b
j.s = b
j.u = g
j.y = i
g.p = b
g.w = b
g.o = n
assert j.x.o.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.o: B = None
        self.txt = txt

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

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

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

b = A("b")
a = B("a")
c = C("c")
e = D("e")
m = C("m")
i = B("i")
n = B("n")
j = D("j")
g = A("g")

b.p = g
b.w = g
b.o = a
a.u = i
c.w = b
e.x = g
e.s = g
e.u = g
e.y = a
m.w = b
i.u = n
n.u = a
j.x = b
j.s = b
j.u = g
j.y = i
g.p = b
g.w = b
g.o = n
assert j.x.o.u.u.u.u.u.u.u.txt == "i"