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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: A = None
        self.p: D = None
        self.v: F = None
        self.r: D = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: A = None
        self.x: F = None
        self.q: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

h = A("h")
j = B("j")
m = C("m")
g = D("g")
d = E("d")
i = F("i")

h.o = g
h.z = g
h.r = g
h.p = i
j.t = h
j.s = h
j.p = g
j.r = g
j.v = i
j.u = m
m.v = d
m.y = j
m.s = h
g.p = j
d.v = m
d.o = h
d.q = h
d.x = i
d.p = j
i.x = d
assert g.p.v.x.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: F = None
        self.z: D = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: A = None
        self.p: D = None
        self.v: F = None
        self.r: D = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: A = None
        self.x: F = None
        self.q: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

h = A("h")
j = B("j")
m = C("m")
g = D("g")
d = E("d")
i = F("i")

h.o = g
h.z = g
h.r = g
h.p = i
j.t = h
j.s = h
j.p = g
j.r = g
j.v = i
j.u = m
m.v = d
m.y = j
m.s = h
g.p = j
d.v = m
d.o = h
d.q = h
d.x = i
d.p = j
i.x = d
assert g.p.v.x.v.y.txt == "j"