class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.y: B = None
        self.z: F = None
        self.v: F = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: F = None
        self.s: F = None
        self.txt = txt

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

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

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

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

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

c.r = f
c.s = k
c.t = k
c.y = l
c.z = h
c.v = i
l.q = c
l.v = i
l.s = i
a.t = n
a.r = l
f.p = l
f.z = i
k.t = l
k.o = l
k.p = c
i.r = h
i.w = f
n.t = a
n.r = l
h.r = i
h.w = f
assert k.o.q.r.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.y: B = None
        self.z: F = None
        self.v: F = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: F = None
        self.s: F = None
        self.txt = txt

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

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

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

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

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

c.r = f
c.s = k
c.t = k
c.y = l
c.z = h
c.v = i
l.q = c
l.v = i
l.s = i
a.t = n
a.r = l
f.p = l
f.z = i
k.t = l
k.o = l
k.p = c
i.r = h
i.w = f
n.t = a
n.r = l
h.r = i
h.w = f
assert k.o.q.r.z.w.txt == "f"