class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.x: F = None
        self.txt = txt

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

m = A("m")
k = B("k")
f = C("f")
j = D("j")
l = E("l")
h = F("h")
c = A("c")
g = C("g")
n = E("n")
b = D("b")

m.v = k
m.s = k
m.q = b
k.x = h
f.r = j
j.o = h
l.s = f
l.r = g
l.x = h
h.s = c
h.x = c
h.p = k
c.v = k
c.s = k
c.q = j
g.r = j
n.s = g
n.r = g
n.x = h
b.o = h
assert c.q.o.p.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.x: F = None
        self.txt = txt

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

m = A("m")
k = B("k")
f = C("f")
j = D("j")
l = E("l")
h = F("h")
c = A("c")
g = C("g")
n = E("n")
b = D("b")

m.v = k
m.s = k
m.q = b
k.x = h
f.r = j
j.o = h
l.s = f
l.r = g
l.x = h
h.s = c
h.x = c
h.p = k
c.v = k
c.s = k
c.q = j
g.r = j
n.s = g
n.r = g
n.x = h
b.o = h
assert c.q.o.p.x.p.x.txt == "h"