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

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

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

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

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

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

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

n.y = k
n.v = l
b.w = l
b.p = k
g.q = k
g.r = k
g.z = i
i.v = k
i.o = k
i.r = n
i.u = n
l.t = k
l.r = g
k.p = l
j.v = k
j.o = k
j.r = n
j.u = n
assert k.p.r.r.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

n.y = k
n.v = l
b.w = l
b.p = k
g.q = k
g.r = k
g.z = i
i.v = k
i.o = k
i.r = n
i.u = n
l.t = k
l.r = g
k.p = l
j.v = k
j.o = k
j.r = n
j.u = n
assert k.p.r.r.p.t.p.txt == "l"