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

class B:
    def __init__(self, txt: str):
        self.r: B = 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.o: F = None
        self.p: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: A = None
        self.txt = txt

a = A("a")
n = B("n")
k = C("k")
j = D("j")
d = E("d")
b = F("b")
c = B("c")
i = B("i")
e = D("e")

a.u = k
a.q = b
a.v = e
n.r = c
k.u = j
j.o = b
j.p = d
d.p = c
d.s = a
b.w = j
b.t = a
c.r = n
i.r = n
e.o = b
e.p = d
assert j.o.t.v.p.p.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: F = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = 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.o: F = None
        self.p: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: A = None
        self.txt = txt

a = A("a")
n = B("n")
k = C("k")
j = D("j")
d = E("d")
b = F("b")
c = B("c")
i = B("i")
e = D("e")

a.u = k
a.q = b
a.v = e
n.r = c
k.u = j
j.o = b
j.p = d
d.p = c
d.s = a
b.w = j
b.t = a
c.r = n
i.r = n
e.o = b
e.p = d
assert j.o.t.v.p.p.r.r.r.r.txt == "c"