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

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

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

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

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

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

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

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

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

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

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

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

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

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

j.o = f
j.v = f
j.r = n
j.u = g
n.r = i
g.y = b
g.w = f
g.v = j
i.q = g
i.o = g
i.s = n
a.w = i
a.p = g
a.z = f
b.p = n
b.x = a
k.q = g
k.o = g
k.s = n
f.o = j
f.v = j
f.r = n
f.u = g
assert k.q.y.p.r.q.w.r.r.txt == "i"