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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: F = None
        self.v: A = None
        self.p: F = None
        self.txt = txt

m = A("m")
h = B("h")
n = C("n")
g = D("g")
a = E("a")
b = F("b")
e = C("e")
k = F("k")

m.p = h
h.x = m
h.s = a
n.x = m
n.q = m
n.u = h
n.w = h
n.v = k
n.p = g
g.r = b
a.u = m
a.o = h
b.o = k
b.r = k
b.p = k
b.v = m
e.x = m
e.q = m
e.u = h
e.w = h
e.v = k
e.p = g
k.o = b
k.r = b
k.p = b
k.v = m
assert k.r.v.p.s.u.p.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: F = None
        self.v: A = None
        self.p: F = None
        self.txt = txt

m = A("m")
h = B("h")
n = C("n")
g = D("g")
a = E("a")
b = F("b")
e = C("e")
k = F("k")

m.p = h
h.x = m
h.s = a
n.x = m
n.q = m
n.u = h
n.w = h
n.v = k
n.p = g
g.r = b
a.u = m
a.o = h
b.o = k
b.r = k
b.p = k
b.v = m
e.x = m
e.q = m
e.u = h
e.w = h
e.v = k
e.p = g
k.o = b
k.r = b
k.p = b
k.v = m
assert k.r.v.p.s.u.p.s.u.txt == "m"