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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.q: F = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: A = None
        self.txt = txt

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

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

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

g.r = a
g.w = n
c.p = j
c.s = n
c.w = n
c.t = n
c.q = h
n.v = h
j.x = a
j.r = g
a.v = c
f.p = k
f.t = h
f.z = a
k.p = j
k.s = n
k.w = n
k.t = n
k.q = f
h.p = c
h.t = f
h.z = a
assert h.t.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.q: F = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: A = None
        self.txt = txt

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

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

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

g.r = a
g.w = n
c.p = j
c.s = n
c.w = n
c.t = n
c.q = h
n.v = h
j.x = a
j.r = g
a.v = c
f.p = k
f.t = h
f.z = a
k.p = j
k.s = n
k.w = n
k.t = n
k.q = f
h.p = c
h.t = f
h.z = a
assert h.t.p.s.txt == "n"