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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: A = None
        self.u: F = None
        self.p: D = None
        self.x: A = None
        self.v: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: A = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.q: C = None
        self.r: B = None
        self.txt = txt

d = A("d")
e = B("e")
k = C("k")
l = D("l")
h = E("h")
a = F("a")
g = F("g")
c = A("c")
f = A("f")

d.r = e
d.y = f
d.s = a
e.w = k
e.z = d
e.x = d
e.u = a
e.v = a
e.p = l
k.s = h
k.q = c
k.r = c
l.v = k
l.z = e
l.r = h
l.p = h
h.q = f
a.s = h
a.x = k
a.q = k
a.r = e
g.s = h
g.x = k
g.q = k
g.r = e
c.r = e
c.y = f
c.s = a
f.r = e
f.y = c
f.s = g
assert f.y.s.x.s.q.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: A = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: A = None
        self.u: F = None
        self.p: D = None
        self.x: A = None
        self.v: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: A = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.q: C = None
        self.r: B = None
        self.txt = txt

d = A("d")
e = B("e")
k = C("k")
l = D("l")
h = E("h")
a = F("a")
g = F("g")
c = A("c")
f = A("f")

d.r = e
d.y = f
d.s = a
e.w = k
e.z = d
e.x = d
e.u = a
e.v = a
e.p = l
k.s = h
k.q = c
k.r = c
l.v = k
l.z = e
l.r = h
l.p = h
h.q = f
a.s = h
a.x = k
a.q = k
a.r = e
g.s = h
g.x = k
g.q = k
g.r = e
c.r = e
c.y = f
c.s = a
f.r = e
f.y = c
f.s = g
assert f.y.s.x.s.q.s.s.q.txt == "f"