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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.x: D = None
        self.z: F = None
        self.y: C = None
        self.w: F = None
        self.txt = txt

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

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

l.v = b
l.y = j
n.p = j
n.v = j
j.q = n
g.y = l
h.q = n
h.p = n
h.x = g
h.z = b
h.w = b
h.y = j
b.r = k
d.q = n
d.p = n
d.x = g
d.z = b
d.w = b
d.y = j
k.v = b
k.y = j
assert l.v.r.v.r.y.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.x: D = None
        self.z: F = None
        self.y: C = None
        self.w: F = None
        self.txt = txt

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

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

l.v = b
l.y = j
n.p = j
n.v = j
j.q = n
g.y = l
h.q = n
h.p = n
h.x = g
h.z = b
h.w = b
h.y = j
b.r = k
d.q = n
d.p = n
d.x = g
d.z = b
d.w = b
d.y = j
k.v = b
k.y = j
assert l.v.r.v.r.y.q.p.q.txt == "n"