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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

k = A("k")
i = B("i")
h = C("h")
g = D("g")
c = E("c")
a = F("a")
e = G("e")
f = E("f")
m = G("m")
b = F("b")

k.x = g
i.u = h
i.y = c
h.u = g
g.x = k
g.v = a
g.p = i
c.x = f
a.o = m
e.o = g
f.x = c
m.o = g
b.o = m
assert i.u.u.p.u.u.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

k = A("k")
i = B("i")
h = C("h")
g = D("g")
c = E("c")
a = F("a")
e = G("e")
f = E("f")
m = G("m")
b = F("b")

k.x = g
i.u = h
i.y = c
h.u = g
g.x = k
g.v = a
g.p = i
c.x = f
a.o = m
e.o = g
f.x = c
m.o = g
b.o = m
assert i.u.u.p.u.u.p.y.txt == "c"