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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: B = None
        self.v: A = None
        self.s: B = None
        self.z: C = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

m.v = c
m.r = c
m.y = l
m.q = b
f.p = k
f.w = b
n.w = b
n.r = b
n.y = b
n.v = m
n.x = k
c.w = b
k.u = b
k.q = f
k.s = f
k.v = m
k.w = m
k.z = n
b.o = n
l.w = b
a.p = k
a.w = b
assert a.w.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: D = None
        self.y: D = None
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: B = None
        self.v: A = None
        self.s: B = None
        self.z: C = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

m.v = c
m.r = c
m.y = l
m.q = b
f.p = k
f.w = b
n.w = b
n.r = b
n.y = b
n.v = m
n.x = k
c.w = b
k.u = b
k.q = f
k.s = f
k.v = m
k.w = m
k.z = n
b.o = n
l.w = b
a.p = k
a.w = b
assert a.w.o.r.txt == "b"