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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: D = None
        self.o: D = None
        self.x: A = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

n = A("n")
i = B("i")
j = C("j")
l = D("l")
f = E("f")
k = F("k")
m = D("m")
a = F("a")

n.x = j
n.v = j
i.v = j
i.x = k
j.p = m
j.y = i
l.x = n
l.w = f
l.y = i
f.z = l
f.o = l
k.p = i
k.r = l
k.o = m
k.x = n
k.t = n
k.q = j
m.x = n
m.w = f
m.y = i
a.p = i
a.r = l
a.o = l
a.x = n
a.t = n
a.q = j
assert l.w.o.x.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: D = None
        self.o: D = None
        self.x: A = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

n = A("n")
i = B("i")
j = C("j")
l = D("l")
f = E("f")
k = F("k")
m = D("m")
a = F("a")

n.x = j
n.v = j
i.v = j
i.x = k
j.p = m
j.y = i
l.x = n
l.w = f
l.y = i
f.z = l
f.o = l
k.p = i
k.r = l
k.o = m
k.x = n
k.t = n
k.q = j
m.x = n
m.w = f
m.y = i
a.p = i
a.r = l
a.o = l
a.x = n
a.t = n
a.q = j
assert l.w.o.x.x.y.x.txt == "k"